<template>
	<view class="body">
		<xk-header :headerbg="true" :back="true" title="预约结果"></xk-header>
		<view class="top-view">
			<image mode="aspectFill" class="result-img" :src="(imgUrl+'/wx/chenggong.png')"/>
			<view class="result-title">预约成功</view>
			<view class="result-desc">您已成功预约看房，具体时间待物业人员受理完成后另行通知，请注意<strong>查收消息</strong></view>
		</view>
		<view class="appt-title">
			<view>本次共预约</view>
			<text>{{dataList.length}}</text>
			<view>套看房，请滑动查看</view>
		</view>
		<scroll-view class="data-list" scroll-x="true">
			<view :class="dataList.length===1 ? 'data-item data-item-one' : 'data-item'"
				v-for="(item, index) of dataList" :key="index">
				<view class="item-top">
					<view>单号: {{data.apply_no}}</view>
				</view>
				<view class="item-top">
					<view>物业编号: {{item.property_code}}</view>
				</view>
				<view class="item-middel">
					<image v-if="item.property_image" mode="aspectFill" class="img" :src="item.property_image | formatImgPath('260', '195')"/>
					<image v-else mode="aspectFill" class="img" :src="(imgUrl+'/wx/default_img.jpg')"/>
					<view class="info">
						<view>
							<view class="name">{{item.tag_name || "-"}}</view>
							<view class="desc">{{item.real_area || ''}}㎡/{{item.floor_area}}㎡</view>
						</view>
						<view>
							<view v-if="item.pricing_amount" class="amount"><text></text>{{(item.pricing_amount * item.floor_area || "") | formatMoneyNo00}} <text>元/月</text></view>
							<view v-else class="amount">月租面议</view>
							<view v-if="item.pricing_amount" class="desc">{{(item.pricing_amount || "") | formatMoneyNo00}}元/㎡</view>
						</view>
					</view>
				</view>
				<view class="location-view">
					<image mode="aspectFill" class="dingwei" :src="(imgUrl+'/wx/dingwei.png')"/>
					<view class="address">{{item.building || "-"}}/{{item.storey || "-"}}</view>
				</view>
			</view>
		</scroll-view>

		<view class="btn-view">
			<view class="common-btn btn-sty2 btn" @click="goApptRecord()">查询预约记录</view>
			<view class="common-btn btn" @click="backHome()">返回首页</view>
		</view>
	</view>
</template>

<script>
	let noImg = '/static/no-img.png';
	export default {
		data() {
			return {
				isListIn: "0",
				dataList: [],
				look_id: "",
				data: {},
				imgUrl:this.$config.BASE_imgUrl,
			};
		},
		onLoad(options){
			console.warn("options.isListIn: ", options.isListIn)
			if (options && options.isListIn) {
				this.isListIn = options.isListIn
			}
			if (options && options.look_id) {
				this.look_id = options.look_id
			}
			if (options && options.dataList) {
				this.dataList = JSON.parse(options.dataList)
			}

			this.initInfo()
		},
		methods:{
			initInfo() {
				this.$api.piLookingRoom_getPiLookingRoomSingle({
					look_id: this.look_id
				}).then(res => {
					console.warn("看房订单信息：", res)
					this.data = res
				})
			},
			goApptRecord() {
				if (this.isListIn == 1) {
					console.warn("isListInsdf: ", this.isListIn)
					uni.navigateBack()
				} else {
					console.warn("isListIn: ", this.isListIn)
					uni.redirectTo({
						url: "/pages/estate/make-appt-record"
					})
				}
			},
			backHome() {
				uni.switchTab({
					url: '/pages/home/index/index'
				})
				// uni.navigateBack({
				// 	delta: 1000
				// })
			}
		}
	}
</script>

<style lang="scss" scoped>

.top-view {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	margin: 20rpx 30rpx 0rpx 30rpx;
	padding: 50rpx 30rpx;
	background-color: #FFFFFF;
	.result-img {
		width: 140rpx;
		height: 140rpx;
	}
	.result-title {
		color: #333333;
		font-size: 32rpx;
		font-weight: bold;
		margin-top: 30rpx;
	}
	.result-desc {
		color: #999999;
		font-size: 28rpx;
		margin-top: 10rpx;
		text-align: center;
		>strong {
			color: #2C72FF;
		}
	}
}
.appt-title {
	display: flex;
	color: #333333;
	font-size: 28rpx;
	margin: 30rpx 30rpx;
	>text {
		color: #2C72FF;
		margin: 0rpx 10rpx;
	}
}
.data-list{
	display: flex;
	flex-direction: row;
	width: 750rpx;
	white-space: nowrap;

	.data-item {
		display: inline-block;
		flex-direction: column;
		margin-bottom: 30rpx;
		background-color: #FFFFFF;
		border-radius: 10rpx;
		margin: 0rpx 0rpx 0rpx 30rpx;
		padding: 20rpx;
		width:550rpx;
		color: #333;
		font-size: 28rpx;
		white-space: normal;

		.item-top {
			display: flex;
			:first-child {
				flex: 1;
			}
			.del-img {
				width: 40rpx;
				height: 40rpx;
			}
		}

		.item-middel {
			display: flex;
			margin-top: 10rpx;

			.img{
				width: 200rpx;
				height: 150rpx;
				border-radius: 10rpx;
				margin-right: 20rpx;
			}
			.info{
				flex: 1;
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				.name{
					font-size: 28rpx;
					font-weight: 600;
					color: #333333;
				}
				.desc{
					font-size: 24rpx;
					color: #999999;
					font-weight: 400;
				}
				.amount{
					font-size: 36rpx;
					color: #FF3737;
					font-weight: 700;
					text{
						font-size: 24rpx;
						color: #FF3737;
						font-weight: 600;
					}
				}
			}
		}
		.location-view {
			display: flex;
			margin-top: 20rpx;
			align-items: flex-start;

			.dingwei {
				width: 30rpx;
				height: 30rpx;
				margin-top: 5rpx;
			}
			.address {
				font-size: 24rpx;
				color: #333;
				margin-left: 10rpx;
			}
		}
	}

	.data-item-one {
		width: 650rpx
	}
}
.btn-view {
	display: flex;
	align-items: center;
	justify-content:space-around;

	.btn {
		font-size: 28rpx;
		width: 295rpx;
		height: 88rpx;
		margin: 50rpx 0rpx 10rpx 0rpx;
	}

}
</style>
